#include "stdBullet.h"

stdBullet::stdBullet(string& filename, string& filename1, string& filename2)
{
	int start,end;
	float range;
	string tempstr;
	ifstream infile;
	infile.open(filename1.c_str());

	Json::Reader reader;
	Json::Value root;
	if (!reader.parse(infile, root, false))
	{
		cout << "json error";
	}

	int size = root.size();

	for (int i = 0; i < size; i++)
	{
		start = root[i]["startBitmap"].asInt();
		end = root[i]["endBitmap"].asInt();
		range = (float)root[i]["range"].asDouble();
		spd = (float)root[i]["speed"].asDouble();
	}
	
	infile.clear();
	infile.close();

	infile.open(filename.c_str());
	/*getline(infile, tempstr);
	stringstream ss(tempstr);
	ss >> spd >> start >> end >> range;*/
	Resource* r = 0;
	r = r->Instance();
	bitmap.setInformation(r->_arrBullet, start, end, range);
	while (getline(infile, tempstr))
	{
		event.push_back(emenyMessage(tempstr));
	}
	infile.clear();
	infile.close();

	infile.open(filename2.c_str());
	while (getline(infile, tempstr))
	{
		bulletEvent.push_back(emenyMessage(tempstr));
	}
	infile.clear();
	infile.close();
}